<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>编辑排课</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">
			$(function() {
				//初始化表单验证
				$("#inputForm").initValidform();
				
				//初始化编辑器
		        var editor = KindEditor.create('.editor', {
		            width: '100%',
		            height: '350px', 
		            resizeType: 1,
		            uploadJson: '${ctx}/upload?action=EditorFile&IsWater=1&Type=',
		            fileManagerJson: '${ctx}/qd/upload?action=ManagerFile',
		            allowFileManager: true
		        });
		        var editorMini = KindEditor.create('.editor-mini', {
		            width: '100%',
		            height: '250px',
		            resizeType: 1,
		            uploadJson: '${ctx}/qd/upload?action=EditorFile&IsWater=1&type=',
		            items: [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
		        });

		        //初始化上传控件
		        //$(".upload-img").InitUploader({ type:'course', filesize: "", sendurl: "${ctx}/qd/upload", swf: "${ctxStatic}/scripts/webuploader/uploader.swf", filetypes: "" });
		        //$(".upload-video").InitUploader({ type:'course', filesize: "", sendurl: "${ctx}/qd/upload", swf: "${ctxStatic}/scripts/webuploader/uploader.swf", filetypes: "" });
		        $(".upload-course").InitUploader({ type:'course', btntext: "批量上传", multiple: true, water: true, thumbnail: true, filesize: "", sendurl: "${ctx}/qd/upload", swf: "${ctxStatic}/scripts/webuploader/uploader.swf" });
		        $(".upload-classroom").InitUploader({ type:'classroom', btntext: "批量上传", multiple: true, water: true, thumbnail: true, filesize: "", sendurl: "${ctx}/qd/upload", swf: "${ctxStatic}/scripts/webuploader/uploader.swf" });
		        
		        $('#levelId').change(function(){
		        	getSerial();
		        	
		        	var selected = $(this).children('option:selected');
		        	$('#clevel').val(selected.text());
		        });
		        
		        $('#serialId').change(function(){
		        	getTheme();
		        	
		        	var selected = $(this).children('option:selected');
		        	$('#serial').val(selected.text());
		        });
		        
		        $('#themeId').change(function(){
		        	getThemeDesc();
		        	
		        	var selected = $(this).children('option:selected');
		        	$('#theme').val(selected.text());
		        });
		        
		        $('#sectionId').change(function(){
		        	var selected = $(this).children('option:selected');
		        	$('#section').val(selected.text());
		        });
		        
		        $('#teacherId').change(function(){
		        	var selected = $(this).children('option:selected');
		        	$('#teacher').val(selected.text());
		        });
		        
		        $('#teacher2Id').change(function(){
		        	var selected = $(this).children('option:selected');
		        	$('#teacher2').val(selected.text());
		        });
		        $('#classroomId').change(function(){
		        	var selected = $(this).children('option:selected');
		        	$('#classroom').val(selected.text());
		        });
		        
		        $('input[name=priceType]').click(function(){
		        	var centerId = $('#centerId').val(),
		        		priceType = $(this).val();
		            $.post("${ctx}/qd/course/ajax?method=priceType", { "centerId": centerId,'priceType':priceType },function (result) {
	                    if (result != "") {
	                    	getPriceType(result)
	                   	}
	                }, "text");	        	
		        });
		        
		        getPriceType();
		        
		        $('input[disabled]').css({'background-color':'#fdfebf'});
		        $('select[disabled]').parent().css({'background-color':'#fdfebf'});
		        $('select[disabled]').parent().each(function(){
		        	$('.select-tit',this).css({'background':'none'});
		        });
		        
		        $('input[readonly]').css({'background-color':'#fdfebf'});
		        $('select[readonly]').parent().css({'background-color':'#fdfebf'});
		        $('select[readonly]').parent().each(function(){
		        	$('.select-tit',this).css({'background':'none'});
		        });
		        
		        $('#btnReturn').click(function(){
		        	window.location.href = '/qdingding-webapp/a/qd/course/list?mode=week&year=2016&week=13';
		        	return false;
		        });
			});
			
			//获取价格
			function getPriceType(pts){
				
				if(!pts) pts = $('#price').val();
				else $('#price').val(pts);
				
				//如果不存在价格，即为新增情况，直接返回
				if(!pts) return;
				
				var priceType = $('input[name=priceType]:checked').val();
				
            	var priceTypes = eval('('+pts+')');
				
            	$('dl.priceList').remove();
            	
            	$.each(priceTypes,function(index,type){
            		var dl = '<dl class="priceList">'+
    		                    '<dt>#title#</dt>'+
    		                    '<dd>'+
    		                        '<input name="priceList" typeType="#id#" class="input small" <c:if test="${readonly}"> disabled=\'disabled\' </c:if> nullmsg="请输入价格" datatype="*" errormsg="请输入价格" type="text" value="#price#" maxlength="50">'+
    		                    	'<span class="Validform_checktip">*请输入价格(元)</span>'+
    		                    '</dd>'+
    		                '</dl>';
    		        if(priceType==0){
    		        	//忙时，统一价格
    		        	dl = dl.replace(/#title#/ig,'统一价格');
    		        }else{
    		        	//闲时，分段价格
    		        	dl = dl.replace(/#title#/ig,type.starton+'~'+type.endon+'人');
    		        }
    		        dl = dl.replace(/#price#/ig,type.price);
    		        dl = dl.replace(/#id#/ig,type.id);
    		        
                    $('.info-left').append($(dl));
            	});
            	$('dl.priceList input').blur(function(){
            		var _this = $(this);
            		var priceTypes = JSON.parse($('#price').val());
            		$.each(priceTypes,function(index,type){
            			if(type.id==_this.attr('typetype')){
            				type.price = _this.val();
            			}
            		});
            		$('#price').val(JSON.stringify(priceTypes));
            	});
			}
			
			//获取系列
			function getSerial(){
				var levelId = $("#levelId option:selected").val();
	            $.post("${ctx}/qd/course/ajax?method=level", { "levelId": levelId },function (result) {
                    if (result != "") {
                        $("#serialId").html(result);
                        $('.rule-single-select').ruleSingleSelect();
                   	}
                }, "text");
			}
			
			//获取主题
			function getTheme(){
				var levelId = $("#levelId option:selected").val(),
					serialId = $('#serialId option:selected').val();
	            $.post("${ctx}/qd/course/ajax?method=theme", { "levelId": levelId,'serialId':serialId },function (result) {
                    if (result != "") {
                        $("#themeId").html(result);
                        $('.rule-single-select').ruleSingleSelect();
                   	}
                }, "text");
			}
			
			//获取主题描述
			function getThemeDesc(){
				var themeId = $("#themeId option:selected").val();
	            $.post("${ctx}/qd/course/ajax?method=themeDesc", { "themeId": themeId },function (result) {
                    if (result != "") {
                        $("#themeDesc").html(result);
                   	}
                }, "text");
			}
			
			//添加图片相册
			function addImage(targetObj, data) {
			    //插入到相册UL里面
			    var newLi = $('<li>'
			    + '<input type="hidden" name="hid_photo_name" value="'+ data.type + '|' + data.name + '|' + data.path + '|' + data.thumb + '|' + data.size + '|' + data.ext + '" />'
			    + '<input type="hidden" name="hid_photo_remark" value="" />'
			    + '<div class="img-box" onclick="setFocusImg(this);">'
			    + '<img src="${root}/cdn/image/' + data.thumb + '" bigsrc="${root}/cdn/image/' + data.path + '" />'
			    + '<span class="remark"><i>暂无描述...</i></span>'
			    + '</div>'
			    + '<a href="javascript:;" onclick="setRemark(this);">描述</a>'
			    + '<a href="javascript:;" onclick="delImg(this);">删除</a>'
			    + '</li>');
			    newLi.appendTo(targetObj.siblings(".photo-list").children("ul"));

			    //默认第一个为相册封面
			    var focusPhotoObj = targetObj.siblings(".focus-photo");
			    if (focusPhotoObj.val() == "") {
			        focusPhotoObj.val(thumbSrc);
			        newLi.children(".img-box").addClass("selected");
			    }
			} 
			
			function choose(mode){
				if(top){
					var width = $(top.window).width()-100,height=$(top.window).height()-100;
					var courseId = '${course.id}';
					top.dialog({
						title:'学员选择',
						url:'${ctx}/qd/course/choose?mode='+mode+'&courseId='+courseId,
						width:width, 
						height:height,
						fixed:true,
						oniframeload:function(){
							/*var document = this.iframeNode.document || this.iframeNode.contentDocument;   
							if(document != null) {
								this.iframeNode.height = document.body.scrollHeight;
								this.iframeNode.width = document.body.scrollWidth;
							} */
						}
					}).showModal();
				}
			}
			
			function free(){
				if(top){
					var courseId = '${course.id}';
					top.dialog({
						id:'freeDialog',
						title:'免费体验',
						url:'${ctx}/qd/coursefree/dialog?courseId='+courseId,
						width:'650px', 
						height:'265px',
						padding:0,
						fixed:true,
						oniframeload:function(){
							/*var document = this.iframeNode.document || this.iframeNode.contentDocument;   
							if(document != null) {
								this.iframeNode.height = document.body.scrollHeight;
								this.iframeNode.width = document.body.scrollWidth;
							}*/ 
						}
					}).showModal();
				}
			}
			
			function time(){
				if(top){
					var courseId = '${course.id}';
					top.dialog({
						id:'timeDialog',
						title:'上课时间调整',
						url:'${ctx}/qd/course/time?id='+courseId,
						width:'650px', 
						height:'265px',
						padding:0,
						fixed:true,
						oniframeload:function(){
							/*var document = this.iframeNode.document || this.iframeNode.contentDocument;   
							if(document != null) {
								this.iframeNode.height = document.body.scrollHeight;
								this.iframeNode.width = document.body.scrollWidth;
							}*/ 
						}
					}).showModal();
				}
			}
			
			function freeOrder(){
				if(top){
					var courseId = '${course.id}';
					top.freeOrderDialog_a = top.dialog({
						id:'freeOrderDialog',
						title:'免费预约',
						url:'${ctx}/qd/course/freeorder?courseid='+courseId,
						width:'800px', 
						height:'600px',
						padding:0,
						fixed:true,
						oniframeload:function(){
						},
						onclose:function(){
							window.location.reload();
						}
					}).showModal();
				}
			}
			
			function giftOrder(){
				if(top){
					var courseId = '${course.id}';
					top.giftOrderDialog_a=top.dialog({
						id:'giftOrderDialog',
						title:'赠课预约',
						url:'${ctx}/qd/course/giftorder?courseid='+courseId,
						width:'800px', 
						height:'600px',
						padding:0,
						fixed:true,
						oniframeload:function(){
						},
						onclose:function(){
							window.location.reload();
						}
					}).showModal();
				}
			}
			
			function stop(){
				var courseId = '${course.id}';
				confirmx('确定取消课程吗?','${ctx}/qd/course/stop?mode=${mode}&p1=${p1}&p2=${p2}&id='+courseId);
			}
			
			function save(){
				$('#inputForm').submit();
				return false;
			}
			
			//预约课程
			function order(mode){
				$('#orderForm').submit();
				return false;
			}
			
			var rowTemp = 
				'<tr>'+
				'	<td style="text-align: center;">{maxserial}</td>'+
			    '	<td>{studentName}</td>'+
			    '	<td>{memberName}</td>'+
			    '	<td>{mobile}</td>'+
			    '	<td>{state}</td>'+
			    '	<td style="text-align: center;"></td>'+
			    '	<td align="center"></td>'+
			    '	<td align="center"></td>'+
				'	<td align="center"><a class="delete" row-data="{studentId}" href="#">删除</a></td>'+
				'</tr>';
			
			function chooseStudent(data){
				if(!(data && data.row)){
					show('无法预约，无法获取对话框选择学员信息');
					return;
				}

                var rows = data.row.split(/,/);
                if(rows.length<4){
                	show('无法预约，对话框选择学员信息有误');
					return;
                }
				
				var capacity = $('#capacity').val();
				if(!capacity || capacity<=0){
					show('无法预约，请先设置课程');
					return;
				}
                
				var maxSerial = parseInt($('#tbStudents tr:last td:first').html());
                if(!maxSerial){
                	maxSerial = 0;
                }
                var row = rowTemp.replace(/\{maxserial\}/ig, maxSerial+1);//序号
                
                var isqueue = false;
                if((maxSerial+1)>capacity){
                	isqueue = true;
                }
                
				var studentId = rows[0] + '|'+ (isqueue?'queue':'order');
				
				var sids = $('#orderStudents').val();//预约学员ID
                if(sids.indexOf(','+studentId+',')>=0){
                	show('该学员已经预约');
					return;
                }
                
                row = row.replace(/\{state\}/ig, (isqueue?'排队':'预约'));//状态
                row = row.replace(/\{studentName\}/ig, rows[1]);//学员名称
                row = row.replace(/\{memberName\}/ig, rows[2]);//家长名称
                row = row.replace(/\{mobile\}/ig, rows[3]);//手机
                row = row.replace(/\{studentId\}/ig, studentId);//学生编号
                
                sids = sids.substring(0,sids.length-1);
                $('#orderStudents').val(sids+','+studentId+',');
                
                $('#tbStudents>tbody').append(row);
                
                $('.delete','#tbStudents>tbody tr:last').click(function(){
                	var sids = $('#orderStudents').val();//预约学员ID
                	var sid = ',' + $(this).attr('row-data') + ',';
                	sids = sids.replace(sid,'') + ',';
                	
                	if(sids === ','){
                		sids = '';
                	}
                	
                	$('#orderStudents').val(sids);
                	
                	$(this).parent().parent().remove();
                	return false;
                });
                
                show('成功加入'+ (isqueue?'排队':'预约') +'列表');
			}
			
			function show(msg){
				var d = top.dialog({
					content:msg
				}).show();
				setTimeout(function () {
				    d.close().remove();
				}, 2000);
			}
			
			function showModal(title,msg){
				var d = top.dialog({
					title:title,
					content:msg
				}).showModal();
			}
			
			function addLabelInput(){
				var labelDiv = document.getElementById("labelDiv");
				if($("#labelDiv").children().length <5){
					var labelInput = document.createElement("input");
					labelInput.setAttribute("name","labels");
					labelInput.setAttribute("class","input");
					labelInput.setAttribute("style","width: 80px;float: left;margin-left: 5px;margin-top: 5px;");
					labelDiv.appendChild(labelInput);
				}
			}
			
		</script>
		<style type="text/css">
			.addlabel{
				width: 20px;
				height: 20px;
				border-radius:10px;
				overflow: hidden;
				border: 1px solid #ccc;
				float: left;
				margin-top: 10px;
				margin-left: 5px;
			}
		</style>
	</head>
	
	<body class="mainbody">
		<sys:message content="${message}"/>
		${infos}
		<!--导航栏--> 
		<div class="location">
			<a href="${ctx}/qd/course/list" class="back"><i></i><span>返回列表页</span></a>
			<a href="${ctx}/center" class="home"><i></i><span>首页</span></a> 
			<i class="arrow"></i> 
			<a href="${ctx}/qd/course/form?id=${course.id}"><span>排课</span></a>
			<shiro:hasPermission name="qd:course:edit"><i class="arrow"></i><span>${not empty course.id ? '修改':'添加' }排课</span></shiro:hasPermission>
		</div>
		<div class="line10"></div>
		<!--/导航栏-->

		<!--内容-->
		<div id="floatHead" class="content-tab-wrap">
			<div class="content-tab">
				<div class="content-tab-ul-wrap">
					<ul>
						<li><a class="selected" href="javascript:;">排课信息</a></li>
					</ul>
				</div>
			</div>
		</div>
		<div class="tab-content">
			<div class="info-warp">
			
				<!--左边信息-->
				<form:form id="inputForm" modelAttribute="course" action="${ctx}/qd/course/save?mode=${mode}&p1=${p1}&p2=${p2}" method="post" class="form-horizontal">
					<%-- <form:hidden path="id"/> --%>
					<form:hidden path="centerId"/>
					
		            <div class="info-left">
		            	<c:if test="${not empty course.id}">
		            	<dl>
		                    <dt>课程ID</dt>
		                    <dd>
		                    	<form:input path="id" htmlEscape="false" style="width:80px; padding-left:8px;" readonly="true" maxlength="5000" class="required" cssClass="input normal" datatype="*" nullmsg="请输入课程编号" errormsg="请输入课程编号" sucmsg=" "/>
		                    </dd>
		                </dl>
		            	</c:if>
		            	<dl>
		                    <dt>上课时间</dt>
		                    <dd>
		                    	<div class="date-input">
			                    	<i></i>
			                    	<fmt:formatDate value="${course.ondate}" pattern="yyyy-MM-dd" var="ondate"/>
									<form:input path="ondate" htmlEscape="false" value="${ondate}" maxlength="50" disabled="${readonly }" class="required" cssClass="input-build normal-build"  onfocus="WdatePicker()" datatype="/^\s*$|^\d{4}\-\d{1,2}\-\d{1,2}$/" nullmsg="请输入上课日期" errormsg="请输入上课日期" sucmsg=" "/>
		                    	</div>
								<div class="rule-single-select single-select">
		                             <form:select path="sectionId" htmlEscape="false" class="required" disabled="${readonly }"  cssClass="input normal" datatype="*" nullmsg="请输入上课时段" errormsg="请输入上课时段" sucmsg=" ">
										<form:option value="">请选择...</form:option>
										<form:options items="${sectionList}" itemLabel="name" itemValue="id"/>
									</form:select>
									<form:hidden path="section"/>
		                        </div>
		                    </dd>
		                </dl>
		                <dl >
		                    <dt>课程类别</dt>
		                    <dd>
		                        <div class="rule-single-select single-select">
									<form:select path="type">
										<form:option value="0" selected="selected">普通课程</form:option>
										<form:option value="1">户外课程</form:option>
										<form:option value="2">免费体验课程</form:option>
										<%-- <form:options items="${fns:getDictList('course_type')}" itemLabel="label" itemValue="value"/> --%>
									</form:select>
								</div>
		                    </dd>
		                </dl>
		                <dl >
		                    <dt>课程标签</dt>
		                    <dd>
		                    	<div id="labelDiv">
		                    		<c:forEach items="${labelList }"  var="label">
		                    			<input name="labels" class="input"  style="width: 80px;float: left;margin-left: 5px;margin-top: 5px;" value="${label }"/>
		                    		</c:forEach>
		                    	</div>	
		                    	<a href="javascript:addLabelInput();">
			                    	<div class="addlabel" align="center" >
				                    		<p style="line-height:20px;font-size: 18px;color: #16a0d3">+</p>
		                    		</div>
	                    		</a>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>上课教室</dt>
		                    <dd>
		                        <div class="rule-single-select single-select">
		                            <form:select path="classroomId" htmlEscape="false" class="required" cssClass="input normal" datatype="*" nullmsg="请输入上课教室" errormsg="请输入上课教室" sucmsg=" ">
										<form:option value="">请选择...</form:option>
										<form:options items="${classroomList}" itemLabel="name" itemValue="id"/>
									</form:select>
									<form:hidden path="classroom"/>
		                        </div>
		                        <span class="Validform_checktip"></span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>容量</dt>
		                    <dd>
		                        <form:input path="capacity" htmlEscape="false" maxlength="50" disabled="${readonly }" class="required" cssClass="input normal" datatype="*" nullmsg="请输入容量" errormsg="请输入容量" sucmsg=" "/>
		                    	<span class="Validform_checktip">*请输入容量</span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>老师1</dt>
		                    <dd>
		                        <div class="rule-single-select single-select">
		                        	<form:select path="teacherId" htmlEscape="false" class="required" cssClass="input normal" datatype="*" nullmsg="请输入老师1" errormsg="请输入老师1" sucmsg=" ">
										<form:option value="">请选择...</form:option>
										<form:options items="${teacherList}" itemLabel="name" itemValue="id"/>
									</form:select>
									<form:hidden path="teacher"/>
		                        </div>
		                        <span class="Validform_checktip">*请输入老师1</span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>老师2</dt>
		                    <dd>
		                        <div class="rule-single-select single-select">
			                        <form:select path="teacher2Id" htmlEscape="false" class="required" cssClass="input normal" datatype="*" nullmsg="请输入老师2" errormsg="请输入老师2" sucmsg=" ">
											<form:option value="">请选择...</form:option>
											<form:options items="${teacherList}" itemLabel="name" itemValue="id"/>
									</form:select>
									<form:hidden path="teacher2"/>
		                        </div>
		                        <span class="Validform_checktip">*请输入老师2</span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>课程阶段</dt>
		                    <dd>
		                        <div class="rule-single-select single-select">
		                           	<form:select path="levelId" htmlEscape="false" disabled="${readonly }" class="required" cssClass="input normal" datatype="*" nullmsg="请输入上课阶段" errormsg="请输入上课阶段" sucmsg=" ">
										<form:option value="">请选择...</form:option>
										<form:options items="${levelList}" itemLabel="name" itemValue="id"/>
									</form:select>
									<form:hidden path="clevel"/>
		                        </div>
		                        <span class="Validform_checktip"></span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>课程系列</dt>
		                    <dd>
		                        <div class="rule-single-select single-select">
		                        	<form:select path="serialId" htmlEscape="false" class="required" disabled="${readonly }" cssClass="input normal" datatype="*" nullmsg="请输入课程系列" errormsg="请输入课程系列" sucmsg=" ">
										<form:option value="">请选择...</form:option>
										<form:options items="${serialList}" itemLabel="name" itemValue="id"/>
									</form:select>
									<form:hidden path="serial"/>
		                        </div>
		                        <span class="Validform_checktip"></span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>课程主题</dt>
		                    <dd>
		                        <div class="rule-single-select single-select">
		                        	<form:select path="themeId" htmlEscape="false" class="required" disabled="${readonly }" cssClass="input normal" datatype="*" nullmsg="请输入课程主题" errormsg="请输入课程主题" sucmsg=" ">
										<form:option value="">请选择...</form:option>
										<form:options items="${themeList}" itemLabel="name" itemValue="id"/>
									</form:select>
									<form:hidden path="theme"/>
		                        </div>
		                        <span class="Validform_checktip">*请输入课程主题</span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>主题介绍</dt>
		                    <dd>
		                        <form:textarea path="themeDesc" rows="5" htmlEscape="false" maxlength="5000" class="required" cssClass="input normal" datatype="*" nullmsg="请输入主题介绍" errormsg="请输入主题介绍" sucmsg=" "/>
								<span class="Validform_checktip">*请输入主题介绍</span>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>课程图片</dt>
		                    <dd>
		                        <div class="upload-box upload-course"></div>
		                        <div class="photo-list">
			                        <ul>
			                        	<c:forEach items="${courseAlbum }" var="ca">
			                        	<li>
			                        		<input type="hidden" name="hid_photo_name" value="${ca.category }|${ca.fileName }|${ca.orginPath }|${ca.thumbPath }|${ca.albumSize }|jpg">
			                        		<input type="hidden" name="hid_photo_remark" value="${ca.remarks }">
			                        		<div class="img-box" onclick="setFocusImg(this);">
			                        			<img src="${root}/cdn/image/${ca.thumbPath }" bigsrc="${root}/cdn/image/${ca.orginPath }">
			                        			<span class="remark"><i>${empty ca.remarks ? '暂无描述...': ca.remarks}</i></span>
			                        		</div>
			                        		<a href="javascript:;" onclick="setRemark(this);">描述</a>
			                        		<a href="javascript:;" onclick="delImg(this);">删除</a>
		                        		</li>
			                        	</c:forEach>
			                        </ul>
			                        <div style="clear:both;"></div>
		                        </div>
		                        <div style="margin-top:10px;">
		                            <p style="line-height:5px;">建议上传图片尺寸<strong style="color:#ff0000;">750*365</strong></p>
		                        	<strong>用于课程详细上方显示</strong>
		                        </div>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>课堂相册</dt>
		                    <dd>
		                        <div class="upload-box upload-classroom"></div>
	                            <div class="photo-list">
	                            	<ul>
	                            	<c:forEach items="${classroomAlbum }" var="ca">
			                        	<li>
			                        		<input type="hidden" name="hid_photo_name" value="${ca.category }|${ca.fileName }|${ca.orginPath }|${ca.thumbPath }|${ca.albumSize }|jpg">
			                        		<input type="hidden" name="hid_photo_remark" value="${ca.remarks }">
			                        		<div class="img-box" onclick="setFocusImg(this);">
			                        			<img src="${root}/cdn/image/${ca.thumbPath }" bigsrc="${root}/cdn/image/${ca.orginPath }">
			                        			<span class="remark"><i>${empty ca.remarks ? '暂无描述...': ca.remarks}</i></span>
			                        		</div>
			                        		<a href="javascript:;" onclick="setRemark(this);">描述</a>
			                        		<a href="javascript:;" onclick="delImg(this);">删除</a>
		                        		</li>
			                        	</c:forEach>
	                            	</ul>
	                           		<div style="clear:both;"></div>
	                          		</div>
	                            <div style="margin-top:10px;">
		                        	<strong>用于课程详情下方课堂相册显示</strong>
	                            </div>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>价格种类</dt>
		                    <dd>
		                    	<div class="rule-multi-radio">
									<form:radiobuttons path="priceType" disabled="${readonly }" items="${fns:getDictList('price_type')}"  itemValue="value"  itemLabel="label" htmlEscape="false"  class="required" />
							    </div>
		                    </dd>
		                </dl>
		                <dl>
		                    <dt>价格设置</dt>
		                    <dd>
		                        <form:hidden path="price" htmlEscape="true"/>
		                    </dd>
		                </dl>
		            </div>
	            </form:form>
	            <!--左边信息/结束-->
	        </div>
	        <!--右边信息-->
	        <div class="info-right">
	        	<form id="orderForm" method="post" action="${ctx}/qd/course/order?mode=${mode}&p1=${p1}&p2=${p2}">
	        		<input id="orderStudents" name="orderStudents" type="hidden" value="">
	        		<input id="courseId" name="courseId" type="hidden" value="${course.id}">
	        		
		        	<div class="table-warp">
		                <table id="tbStudents" class="table_notborder" style="width:584px;">
		                    <caption class="table-title">预约学员</caption>
		                    <thead>
			                    <tr>
			                        <th style="width:80px;">序号</th>
			                        <th>学员</th>
			                        <th>家长</th>
			                        <th>联系电话</th>
			                        <th>状态</th>
			                        <th>已扣费</th>
			                        <th>费用返还</th>
			                        <th>特权类型</th>
			                        <th>操作</th>
			                    </tr>
		                    </thead>
		                    <tbody>
			                <c:forEach items="${studentList}" var="orderStudent" varStatus="orderStatus">
								<tr>
									<td style="text-align: center;">${orderStatus.count }</td>
								    <td>${orderStudent.student.name }</td>
								    <td>${orderStudent.member.name }</td>
								    <td>${orderStudent.member.mobile }</td>
								    <td>
								    	<c:choose>
								    		<c:when test="${orderStudent.state == 'queuing'}">排队</c:when>
								    		<c:when test="${orderStudent.state == 'ordered'}">预约</c:when>
								    		<c:when test="${orderStudent.state == 'signed'}">签到</c:when>
								    		<c:when test="${orderStudent.state == 'absented'}">旷课</c:when>
								    		<c:when test="${orderStudent.state == 'leaved'}">请假</c:when>
								    		<c:when test="${orderStudent.state == 'canceled'}">取消</c:when>
								    		<c:when test="${orderStudent.state == 'aborted'}">中止</c:when>
							    		</c:choose>
							    	</td>
								    <td style="text-align: center;">${orderStudent.paid==1?'已扣费':'未扣费' }</td>
								    <td align="center">${orderStudent.money}</td>
								    <td align="center">
									    <a onclick="return confirmx('确定该课程请假？', this.href);" href="${ctx}/qd/course/leave?userId=${orderStudent.member.id }&type=${orderStudent.type }&courseId=${orderStudent.courseId }&studentId=${orderStudent.studentId}&mode=${mode}&p1=${p1}&p2=${p2}">请假</a>
									    &nbsp;|&nbsp;
									    <a onclick="return confirmx('确定中止课程？', this.href);" href="${ctx}/qd/course/abort?userId=${orderStudent.member.id }&type=${orderStudent.type }&courseId=${orderStudent.courseId }&studentId=${orderStudent.studentId}&mode=${mode}&p1=${p1}&p2=${p2}">中止</a></td>
									<td align="center"><a onclick="return confirmx('确定取消课程？', this.href);" href="${ctx}/qd/course/cancel?userId=${orderStudent.member.id }&type=${orderStudent.type }&courseId=${orderStudent.courseId }&studentId=${orderStudent.studentId}&mode=${mode}&p1=${p1}&p2=${p2}">取消</a></td>
								</tr>
							</c:forEach>
		                    </tbody>
		                </table>
		                <div style="width:582px; text-align: center; border:1px solid #eee; border-top:none; line-height:28px;">
		                	<a href="javascript:void(0);"  onclick="choose('choose');">选择学员</a>
		                	&nbsp;|&nbsp;
		                	<a href="javascript:void(0);" onclick="order('choose')">确认预约</a>
		                	 &nbsp;|&nbsp;
		                	<a href="javascript:void(0);" onclick="freeOrder();">免费预约</a>
		                	&nbsp;|&nbsp;
		                	<a href="javascript:void(0);" onclick="giftOrder();">赠课预约</a>
		                </div>
		            </div>
		            <div class="table-warp" style="display:none;">
		                <table class="table_notborder" style="font-size: 12px; width:100%;">
		                    <caption class="table-title">排队学员(0)</caption>
		                    <thead>
			                    <tr>
			                        <th style="width:80px;">序号</th>
			                        <th>学员</th>
			                        <th>家长</th>
			                        <th>联系电话</th>
			                        <th>操作</th>
			                    </tr>
		                    </thead>
		                    <tbody>
			                    <tr>
			                        <td style="text-align: center;" colspan="5">
			                            <a href="#" onclick="choose('queue');">选择学员</a>
			                        </td>
			                    </tr>
		                    </tbody>
		                </table>
		            </div>
	        	</form>
	        	
	        	<form id="freeForm" method="post" action="${ctx}/qd/course/free?mode=${mode}&p1=${p1}&p2=${p2}">
	        		<div class="table-warp">
		                <table class="table_notborder" style="font-size: 12px; width:100%; text-align: center;">
		                    <caption class="table-title">免费体验</caption>
		                    <thead>
			                    <tr>
			                        <th style="width:80px;">序号</th>
			                        <th>家长姓名</th>
			                        <th>手机</th>
			                        <th>宝宝姓名</th>
			                        <th>出生年月</th>
			                    </tr>
		                    </thead>
		                    <tbody>
			                <c:forEach items="${freeList}" var="free" varStatus="freeStatus">
								<tr>
									<td style="text-align: center;">${freeStatus.count }</td>
								    <td>${free.memberName }</td>
								    <td>${free.memberMobile }</td>
								    <td>${free.studentName }</td>
								    <td> <fmt:formatDate value="${free.studentBirthday }" pattern="yyyy-MM-dd"/></td>
							    </tr>
							</c:forEach>
		                    </tbody>
		                </table>
		                <div style="text-align: center; border:1px solid #eee; border-top:none; line-height:28px;">
		                	<a href="javascript:void(0);"  onclick="free();">免费体验</a>
		                </div>
		            </div>
	            </form>
	        </div>
	        <!--右边信息/结束-->
	    </div>
		<!--/内容-->

		<!--工具栏-->
		<div class="page-footer">
			<div class="btn-wrap">
				<shiro:hasPermission name="qd:course:edit">
				<input type="submit" onclick="save();" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" />
				<c:if test="${readonly}">
					<input type="button" onclick="time();" name="btnTime" value="上课时间调整" id="btnTime" class="btn" />
				</c:if>
				<input type="button" onclick="stop();" name="btnStop" value="取消课程" id="btnStop" class="btn" /> 
				</shiro:hasPermission> 
				<a href="${ctx}/qd/stat/signedexport?courseid=${course.id}"><input type="button"  name="btnStop" value="导出签到表" id="btnStop" class="btn" /></a> 
				<input id="btnReturn" name="btnReturn" type="button" value="返回上一页" class="btn yellow" />
			</div>
		</div>
		<!--/工具栏-->
	</body>
</html>

